/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufscar.compiladores.ast;

import java.util.*;
import java.io.*;

public class Program {
    
    private Collection<VarDecList> globalVarList;
    private ProcedureDecList procList;

    public Program(Collection<VarDecList> globalVarList, ProcedureDecList procList) {
        this.globalVarList = globalVarList;
        this.procList = procList;
    }

    public void genC(PW pw) {
        pw.out.println("#include <stdio.h>");

        pw.out.println("");
        
        //print global variables
        for (VarDecList varDecList : globalVarList){
            varDecList.genC(pw);
        }
        pw.out.println("");
        //print procedures dec
        procList.genC(pw);
        
        // generate code for procedures and functions
        //Enumeration e = procfuncList.elements();
        //while (e.hasMoreElements()) {
        //    ((Subroutine) e.nextElement()).genC(pw);
        //    pw.out.println("");
        //    pw.out.println("");
        //}
    }
    
}
